package com.pdstudio.carrecom.ui.activity.myclub;

import com.pdstudio.carrecom.R;
import com.pdstudio.carrecom.api.ServiceHelper;
import com.pdstudio.carrecom.app.AppContext;
import com.pdstudio.carrecom.ui.activity.ActivityWebView;

import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
 * 我的俱乐部
 * 类: ActivityMyClubMain <br>
 * 描述: TODO <br>
 * 作者: xiangzhaoyu  <br>
 * 时间: 2015-6-15 下午2:56:40
 */
public class ActivityMyClubMain extends Activity {

	private View customLiveIndexTitleView;
	private TextView txtTitle;
	private ImageView ivBack;
	
	private int currentFrag=1;//1表示step1,2表示step2
	private Fragment currentFragment;
	
	private LinearLayout mLottery,mMoreFuny,mNewActivity,mCollection,mShare,mBreakRule,mBehind,mMyPoints;
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_myclub_main);

		initTitle();
		InitialView();
	}
	
	private void initTitle() {
		txtTitle = (TextView) findViewById(R.id.title_text_nav);

		txtTitle.setText("我的俱乐部");

		ivBack = (ImageView) findViewById(R.id.title_back);
		ivBack.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				finish();				
			}
		});
	}
	
	private void InitialView(){
		mLottery=(LinearLayout)findViewById(R.id.myclub_lottery);
		mLottery.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent=new Intent(ActivityMyClubMain.this,ActivityWebView.class);
				intent.putExtra("url", ServiceHelper.ChouJiang+"?os=android&id="+AppContext.getInstance().getUserId());
				intent.putExtra("title", "抽奖");
				startActivity(intent);
			}});
		
		mMoreFuny=(LinearLayout)findViewById(R.id.myclub_more);
		mMoreFuny.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent=new Intent(ActivityMyClubMain.this,ActivityMyClubMore.class);
				startActivity(intent);
			}});
		
		mNewActivity=(LinearLayout)findViewById(R.id.myclub_newactivities);
		mNewActivity.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent=new Intent(ActivityMyClubMain.this,ActivityNewActivity.class);
				startActivity(intent);
			}});
		
		mCollection=(LinearLayout)findViewById(R.id.myclub_collection);
		mCollection.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent=new Intent(ActivityMyClubMain.this,ActivityMyCollection.class);
				startActivity(intent);
			}});
		
		mShare=(LinearLayout)findViewById(R.id.myclub_share);
		mShare.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent=new Intent(ActivityMyClubMain.this,ActivityMyShare.class);
				startActivity(intent);
			}});
		
		mBreakRule=(LinearLayout)findViewById(R.id.myclub_crime);
		mBreakRule.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent=new Intent(ActivityMyClubMain.this,ActivityBreakRule.class);
				startActivity(intent);
			}});
		
		mBehind=(LinearLayout)findViewById(R.id.myclub_behind);
		mBehind.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent=new Intent(ActivityMyClubMain.this,ActivityBehind.class);
				startActivity(intent);
			}});
		
		mMyPoints=(LinearLayout)findViewById(R.id.myclub_mypoints);
		mMyPoints.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent=new Intent(ActivityMyClubMain.this,ActivityMyPoints.class);
				startActivity(intent);
			}});
		

		
	}
	
	public void openFragment(Fragment f){
		try{
			getFragmentManager().beginTransaction()
			.replace(R.id.fg_fragment, f).commit(); // 允许丢失状态
			currentFragment=f;
		}catch(Exception e){}
	}

	
}
